package cn.zn.modules.pz.cur.service.impl;

import cn.zn.framework.common.utils.PageUtils;
import cn.zn.modules.pz.cur.entity.dto.PzQueryDTO;
import cn.zn.modules.pz.cur.service.TpMainService;
import cn.zn.modules.pz.inter.PzInter;
import cn.zn.modules.pz.inter.vo.PzForInvoiceVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("pzInter")
public class PzInterImpl implements PzInter {

    @Autowired
    private TpMainService tpMainService;

    @Override
    public PzForInvoiceVO findPz(String applyCode) {
        PzForInvoiceVO pzForInvoice = tpMainService.findPzForInvoice(applyCode);
        return pzForInvoice;
    }

    @Override
    public long findCountToAppoint(String userCode) {
        return tpMainService.findCountToAppoint(userCode);
    }

    @Override
    public long findCountToExpense(String userCode) {
        PzQueryDTO pzQueryDTO = new PzQueryDTO();
        pzQueryDTO.setApplyUserCode(userCode);
        pzQueryDTO.setState(3);
        pzQueryDTO.setIsExpense(false);
        PageUtils pageUtils = tpMainService.queryPage(pzQueryDTO);
        return pageUtils.getTotalCount();
    }

    @Override
    public long findCountToRepay(String userCode) {
        return 0;
    }

    @Override
    public Integer curFinancialYear() {
        return tpMainService.curFinancialYear();
    }
}
